using System;
using System.Reflection;
using System.Collections.Generic;

namespace Open.Data.Persistence
{ 
    //Follows the singleton design pattern
	public class Provider: IProvider 
	{
		//Singleton instance
		public static readonly Provider Instance = new Provider();

		//Property variables
        private static ReflectionCache _reflectionCache;
        
		//Constructors
		private Provider()
		{
            _reflectionCache = new ReflectionCache(this);
		}

        //Properties
    	public ReflectionCache ReflectionCache
		{
			get
			{
				return _reflectionCache;
			}
		}

        //Methods
        public ReflectionParser CreateParser()
        {
            return new ReflectionParser();
        }

        public CacheItem CreateCacheEntry(Type type, ReflectionParser parser)
        {
            return new CacheItem(type, parser);
        }
	}
}
